
	package com.inotai.jasmine.value;

	class Value
	{
		private ValueType type;
		
		
		/**
		  * Creates a NULL value.
		  * 
		  * @param value
		  * @return Value
		  */
		static final Value createNullValue() {
			return new Value();
		}
		
		
		/**
		  * Creates a boolean value.
		  * 
		  * @param value
		  * @return BooleanValue
		  */
		static final BooleanValue createBooleanValue( boolean value ) {
			return new BooleanValue( value );
		}
		
		
		/**
		  * Creates an integer value.
		  * 
		  * @param value
		  * @return IntegerValue
		  */
		static final IntegerValue createIntegerValue( int value ) {
			return new IntegerValue( value );
		}
		
		
		/**
		  * Creates a real value.
		  * 
		  * @param value
		  * @return RealValue
		  */	
		static final RealValue createRealValue( double value ) {
			return new RealValue( value )
		}
		
		static final StringValue createStringValue( String string ) {
			return new StringValue( string, StringType.DOUBLE_QUOTED );
		}
		 
		static final StringValue createStringValue( String string, StringType stringType ) {
			return new StringValue( string, stringType );
		}
		 
		static final RegExpValue createRegExpValue( String regExp, String regExpOptions ) {
			return new RegExpValue( regExp, regExpOptions );
		}
		
		static final DictionaryValue createDictionaryValue() {
			return new DictionaryValue();
		}
		
		static final ListValue createListValue() {
			return new ListValue();
		}
		
		public Value() {
			this(ValueType.NULL);
		}
		
		protected Value( ValueType type ) {
			this.type = type;
		}
		
		public ValueType getType() {
			return this.type;
		}
		
		public boolean getAsBoolean() {
			throw new ValueException("Value is not boolean.");
		}
		
		public int getAsInteger() {
			throw new ValueException("Value is not integer number.");
		}
		
		public float getAsReal() {
			throw new ValueException("Value is not real number.");
		}
		
		String getAsString() {
			throw new ValueException("Value is not string.");
		}
		
		String getAsRegExp() {
			throw new ValueException("Value is not regexp.");
		}
		
		
	}